import  os
# 输出当前文件目录
print(f"当前文件目录：{os.getcwd()}\n")

def tree(pwd,num):
	# 获取当前文件夹里的内容
	PATH = os.listdir(pwd)
	for i in PATH:	
		path = pwd + '/'
		path += i
		num = path.count('/')-1
		if os.path.isfile(path):
        		print(f'|{"--"*num}{i}')
		elif os.path.isdir(path):
			print(f'|{"--"*num}{i}')
			tree(path,num)	
			num -= 1
		else:
			print(f'|{"--"*num}{i}')
pwd = input('请输入想查看文件夹的绝对路径：')
print(f'{pwd}\n|')
tree(pwd,1)
